package com.hrm.houfei.jsonfactory.personfile;

import java.util.List;

import com.hrm.houfei.jsontools.JSONArray;
import com.hrm.houfei.jsontools.JSONObject;
import com.hrm.houfei.po.Personfile;
import com.hrm.houfei.po.Userrole;

/**
 * 数据格式转换类
 * @author Administrator
 *
 */
public class ConvertToJson {

	public ConvertToJson() {
		super();
	}
	
	/**
	 * 将分页list转换成json数据
	 * 
	 * @param list
	 * @return
	 */
	public static String ConverPersonfileListToPageJson(List<Personfile> list, int listCount) {
		JSONArray jsonArray = new JSONArray();
		JSONObject jsonObject = null;
		for (Personfile pf : list) {
			jsonObject = new JSONObject(pf);
			jsonArray.put(jsonObject);
		}
		String json = jsonArray.toString();

		String jsonString = "{\"totalCount\":" + listCount + ",\"rows\":"
				+ json + "}";
		return jsonString;
	}

}
